<?php
// The file
$filename = $_GET['filename'];
$percent = $_GET['percent'];
thumb($filename,$percent);
function thumb($filename,$percent) {
	// Content type
	header('Content-type: image/jpeg');
	// Get new dimensions
	list($width, $height) = getimagesize($filename);
	$new_width = $width * $percent;
	$new_height = $height * $percent;
	
	if ($new_height>190) {
		$new_height=190;
		$new_width=200;
	}
	
	// Resample
	$image_p = imagecreatetruecolor($new_width, $new_height);
	$image = imagecreatefromjpeg($filename);
	imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
	// Output
	imagejpeg($image_p, null, 100);
}
?> 